/**
 * This file is Copyright © 2008 Software Craftsmen Limited. All Rights Reserved.
 */
package com.softwarecraftsmen.generators;

import com.softwarecraftsmen.functors.Optional;
import com.softwarecraftsmen.functors.UnaryFunctor;
import com.softwarecraftsmen.functors.UnaryReturningFunctor;
import com.softwarecraftsmen.generators.summarisers.Summariser;
import org.jetbrains.annotations.NotNull;

public interface Generator<V>
{
	@NotNull
	Optional<V> next();

	void each(final @NotNull UnaryFunctor<V> eachFunctor);

	@NotNull
	Generator<V> identity(final @NotNull UnaryFunctor<V> eachFunctor);

	<T> T summarise(final @NotNull Summariser<V, T> summariser);

	@NotNull
	<T> Generator<T> transform(final @NotNull UnaryReturningFunctor<V, T> transformFunctor);

	@NotNull
	Generator<V> where(@NotNull UnaryReturningFunctor<V, com.softwarecraftsmen.functors.Boolean> whereFunctor);

	@NotNull
	Optional<V> firstMatchWhere(@NotNull UnaryReturningFunctor<V, com.softwarecraftsmen.functors.Boolean> whereFunctor);

}
